﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TemplateWeb.Models.ViewModels.GroupViewModel>" %>
<% 
    ThongTinCongTy thongTinCongTy = null;
    if (Model.ThongTinCongTyModel.GetModel.LstObjModel.Count > 0)
    {
        thongTinCongTy = Model.ThongTinCongTyModel.GetModel.LstObjModel[0];
    }
%>
<div style="padding-top: 10px; overflow: hidden; height: 40px">
    <div style="float: left">
        <a href="<%= Url.Action("Index", "Home") %>">
            <img alt="Gigabook" title="Gigabook" src="../../Content/Images/Home/logo_gigabook.png"
                width="130" border="0" /></a>
    </div>
    <% if (Request.IsAuthenticated)
       { %>
    <div class="user-info">
        Xin chào <b>
            <%= Page.User.Identity.Name %>,</b>&nbsp; <a href="<%= Url.Action("LogOff", "Account") %>"
                style="color: Green; font-weight: bold;">Thoát</a>
        <br>
        <div id="Div1">
            <a href="<%= Url.Action("ThongTinNguoiDung", "Account", new { username = Page.User.Identity.Name }) %>">
                Thông tin tài khoản</a> | <a href="<%= Url.Action("ChangePassword", "Account", new { username = Page.User.Identity.Name }) %>">
                    Thay đổi mật khẩu</a> |
            <% if (Roles.GetRolesForUser(Page.User.Identity.Name)[0].Equals(StringEnum.GetStringValue(LoaiNguoiDung.CUSTOMER)))
               { %>
            <a href="<%= Url.Action("OrdersHistory", "Home", new { username = Page.User.Identity.Name }) %>">
                Lịch sử giao dịch</a>
            <% }
               else
               { %>
            <a href="<%= Url.Action("Index", "Admin") %>">Trang quản trị</a>
            <% } %>
        </div>
    </div>
    <% }
       else
       { %>
    <div class="user-info">
        Xin chào <b>Khách,</b>&nbsp; <span id="HeaderControl1_ltrPoint" style="color: Green">
        </span>
        <br>
        <div id="HeaderControl1_pnlLogin">
            <a href="<%= Url.Action("Login", "Home") %>">Đăng nhập</a> | <a href="<%= Url.Action("Register", "Account") %>">
                Đăng ký</a> | <a href="<%= Url.Action("ResetPassword", "Account") %>">Quên mật khẩu</a>
        </div>
    </div>
    <% } %>
</div>
<div class="clear">
</div>
<div class="top_menu">
    <ul>
        <li id="MenuTopControl1_rptTopMenu_li_0" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_0"
            href="<%= Url.Action("Index", "Home") %>">Trang chủ</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_1" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_1"
            href="<%= Url.Action("DoLuuNiem", "Home") %>">Đồ lưu niệm</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_2" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_2"
            href="<%= Url.Action("GioiThieu", "Home") %>">Giới thiệu</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_3" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_3"
            href="<%= Url.Action("TinTuc", "Home") %>">Tin tức</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_4" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_4"
            href="<%= Url.Action("DoiTac", "Home") %>">Đối tác</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_5" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_5"
            href="<%= Url.Action("LienHe", "Home") %>">Liên hệ</a></li>
        <li id="MenuTopControl1_rptTopMenu_li_6" class="selected"><a id="MenuTopControl1_rptTopMenu_hplLink_6"
            href="<%= Url.Action("YeuCauTimSach", "Home") %>">Yêu cầu tìm sách</a></li>
    </ul>
    <% if (thongTinCongTy != null)
       { %>
    <div class="bg_hotline">
        Hotline:
        <%= thongTinCongTy.DienThoai %></div>
    <% } %>
</div>
<div id="searchBar">
    <div class="search_L">
    </div>
    <div class="search_repx">
        <table width="100%">
            <tbody>
                <tr>
                    <%
                        var tukhoa = ViewData["TuKhoa"] == null ? string.Empty : ViewData["TuKhoa"];
                        var tacgia = ViewData["TacGia"] == null ? string.Empty : ViewData["TacGia"];
                    %>
                    <% using (Html.BeginForm("TimKiem", "Home", FormMethod.Post))
                       { %>
                    <td valign="top" width="100">
                        <%= Html.DropDownList("LoaiSanPham", new SelectList(new[] { StringEnum.GetStringValue(LoaiSanPham.SACH), StringEnum.GetStringValue(LoaiSanPham.DO_LUU_NIEM) }, "Tất cả"))%>
                    </td>
                    <td valign="top" width="180">
                        <input name="TuKhoa" id="SearchBoxControl1_txtSearch" class="inputsearch ac_input"
                            style="height: 19px; width: 180px;" type="text" value="<%= tukhoa %>" />
                    </td>
                    <td valign="top" width="70" align="right" style="padding-right: 10px;">
                        <span style="font-weight: bold; color: White;">Tác giả</span>
                    </td>
                    <td valign="top" width="180">
                        <input name="TimKiemTacGia" class="inputsearch ac_input"
                            style="height: 19px; width: 180px;" type="text" value="<%= tacgia %>" />
                    </td>
                    <td valign="top" width="100">
                        <input value="" class="btn_search" type="submit"
                            style="cursor: pointer;" />
                    </td>
                    <% } %>
                    <td valign="top" width="235">
                        <% 
                            var cartIsEmpty = true;
                            if (Model.ShoppingCartModel != null && Model.ShoppingCartModel.CartItems != null && Model.ShoppingCartModel.CartItems.Count > 0)
                            {
                                cartIsEmpty = false;
                            } 
                        %>
                        <div style="float: right; color: #ffffff; padding-right: 5px; color: White">
                            <% if (cartIsEmpty)
                               { %>
                            <img src="../../Content/Images/Home/ico_cart.gif" align="absmiddle" />&nbsp;&nbsp;Giỏ
                            hàng hiện chưa có sản phẩm
                            <% }
                               else
                               { %>
                            <a href="<%= Url.Action("XemGioHang", "Home") %>" style="color: #FFF">
                                <img src="../../Content/Images/Home/ico_cart.gif" align="absmiddle" />&nbsp;&nbsp;Giỏ
                                hàng hiện có
                                <%= Model.ShoppingCartModel.CartItems.Count %>
                                sản phẩm </a>
                            <% } %>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="search_R">
    </div>
</div>
